﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;
using GalaSoft.MvvmLight;

namespace MODEL
{
    public class User : ViewModelBase, ICheck
    { 
        public int Id { get; set; }
        public string UserId { get; set; } = "admin";
        public string UserName { get; set; }
        public string State { get; set; }
        public string UserStatusDescription => ((UserStatus)(int.Parse(State))).GetDescription();
        public string Sex { get; set; }
        public DateTime Birth { get; set; }
        public string Industry { get; set; }
        public string Department { get; set; }
        public string TelNumber { get; set; }
        public string Address { get; set; }
        public string Email { get; set; }
        public string Mark { get; set; }
        public string AccountStatus { get; set; }
        public string Province { get; set; }
        public string City { get; set; }
        public string County { get; set; }
        public string AddManId { get; set; }
        public string SignKey { get; set; }
        public string StartTime { get; set; }
        public string EndTime { get; set; }
        public Role role { get; set; } = new Role { RoleSign = "Admin" };


        private bool m_IsChecked = false;
        public bool IsChecked
        {
            get { return m_IsChecked; }
            set { m_IsChecked = value; RaisePropertyChanged(() => IsChecked); }
        }

        public override bool Equals(object obj)
        {
            User compareUser = obj as User;
            if (compareUser == null)
            {
                return false;
            }

            return this.Id == compareUser.Id;
        }

        public string StateDescription => this.State != "0" ? "在线" : "离线";
       
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
